﻿<UserControl x:Class="Chapters.Chapter12.MeshMorphAnimationExample"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:Chapter_CustAnim="clr-namespace:FSharp.Chapter12;assembly=FSharpLibrary">
	<UserControl.Resources>
		<ImageBrush x:Key="MeshBrush"
					ImageSource="/Resources;component/Chapter12/world.jpg"
					Stretch="Fill" />

		<Storyboard x:Key="MeshAnimator"
					AccelerationRatio="0.25"
					x:Shared="False">
			<Chapter_CustAnim:MeshMorphAnimation Duration="0:0:2"
												 HorizontalPoints="100"
												 VerticalPoints="100"
												 Storyboard.TargetName="MeshGeometry"
												 Storyboard.TargetProperty="Positions" />
		</Storyboard>
	</UserControl.Resources>
	<DockPanel Background="Black">
		<StackPanel Orientation="Vertical"
					RadioButton.Click="ChangeTargetSurface"
					Background="LightGray"
					Margin="10"
					Width="150">
			<RadioButton IsChecked="True">Plane</RadioButton>
			<RadioButton>Cone</RadioButton>
			<RadioButton>Cylinder</RadioButton>
			<RadioButton>Sphere</RadioButton>
		</StackPanel>
		<Viewport3D x:Name="_viewport">
			<Viewport3D.Camera>
				<PerspectiveCamera FieldOfView="60"
								   Position="0,0,4"
								   LookDirection="0,0,-4"
								   UpDirection="0,1,0" />
			</Viewport3D.Camera>

			<ModelVisual3D>
				<ModelVisual3D.Content>
					<Model3DGroup>
						<AmbientLight Color="LightCyan" />
						<Model3DGroup x:Name="_modelGroup">
							<Model3DGroup.Transform>
								<RotateTransform3D>
									<RotateTransform3D.Rotation>
										<AxisAngleRotation3D x:Name="Rotation"
															 Axis="0,1,0" />
									</RotateTransform3D.Rotation>
								</RotateTransform3D>
							</Model3DGroup.Transform>

						</Model3DGroup>
					</Model3DGroup>

				</ModelVisual3D.Content>
			</ModelVisual3D>

		</Viewport3D>
	</DockPanel>

</UserControl>
